package mvc.Model.Bbs;

import java.util.List;
import java.util.Map;

public class BbsCMTDataMgr {
	public BbsCMTDataDAO getDAO() {
		BbsCMTDataDAO dao = new BbsCMTDataDAO();
		return dao;
	}

	public int getCount(Map map){
		int total=0;
		try{
			total = getDAO().getCount(map);
		}catch(Exception e){
			System.out.println(e);
		}
		
		return total;
	}
	

	public List list(Map map) {
		List<BbsCMTDataDTO> list = null;
		
		try{
			list = getDAO().list(map);
			//for(int i=0; i<list.size(); i++){
			//	BbsCMTDataDTO dto = (BbsCMTDataDTO)list.get(i);
			//	dto.setCmt_story(dto.getCmt_story().replace("\n", "<br>"));
			//	list.set(i, dto);
			//}
			//System.out.println(list.size());
		}catch(Exception e){
		    System.out.println(e.toString());
		}

		return list; 
	}

	public boolean create(BbsCMTDataDTO dto){
		boolean flag  = false;
		try{
			flag = getDAO().create(dto);
			
		}catch(Exception e){
			System.out.println(e);
		}
		
		return flag;
	}

	public boolean update(BbsCMTDataDTO dto){
		boolean flag  = false;
		
		try{
			flag = getDAO().update(dto);
		}catch(Exception e){
			System.out.println(e);
		}
		
		return flag;
	}
	
	public BbsCMTDataDTO read(int cmt_seq){
		BbsCMTDataDTO dto = new BbsCMTDataDTO();
		try{
			dto = getDAO().read(cmt_seq);
		}catch(Exception e){
			System.out.println(e);
		}
		
		return dto;
	}
	
	
	public boolean delete(int cmt_seq){
		boolean flag  = false;
		try{
			
			flag = getDAO().delete(cmt_seq);
			
		}catch(Exception e){
			System.out.println(e);
		}
		
		return flag;
	}
	

}
